home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 224
/
224.d81
/
b.dir to bas
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
2KB
|
86 lines
5 ifpeek(56)<>64thenpoke56,64:run
10 d=peek(186):ifd<8thenstop
15 gosub1000
20 deffnh(x)=int(x/256)
21 deffnl(x)=x-fnh(x)*256
100 rem make a$ a moveable string
101 a$=str$(peek(71)+256*peek(72))
102 a=val(a$)
103 rem a holds length, a+1 holds lo
104 rem a+2 holds hi
105 :
110 f$="l/d.":f=len(f$)+1:rem find string
120 t$="ld.":t=len(t$)+1:rem to string
121 :
149 rem bload directory
150 sys57812"$:"+f$+"*",d,0:poke780,0:poke781,0:poke782,64 :sys65493
151 :
159 rem begin at 64*256 & skip header
160 l=64*256+32
161 l1=2 :rem skip 2 bytes
162 l2=16 :rem length of filename
163 rem check for "block" -- end of dir
164 pokea,5:pokea+1,fnl(l+l1):pokea+2,fnh(l+l1):ifa$="block"then900
169 rem find first quote marks
170 ifpeek(l+l1)<>34thenl1=l1+1:goto170
175 l1=l1+1
179 rem find length to 2nd quote marks
180 ifpeek(l+l1+l2)<>34thenl2=l2-1:goto180
189 rem poke len, lo, hi into a
190 pokea,l2:pokea+1,fnl(l+l1):pokea+2,fnh(l+l1)
191 rem scrub off prefix
192 a$=mid$(a$,f):printa$
193 rem rename to new prefix
194 open15,d,15,"r0:"+t$+a$+"="+f$+a$:close15
198 rem add 32 to location
199 l=l+32:goto161
900 d=dv:goto40000
999 end
1000 poke53280,0:poke53281,0:poke646,0:print"[147]"
1010 k=0:forx=8to15
1020 close2:open2,x,2:close2
1030 ifst=0thenk=k+1:dv(k)=x
1040 next
1050 poke214,10-k/2:print:printtab(05)"[208]lace [204]etter [196]rop [215]riter [196]isk
1051 [153][163]06)"in drive, and choose device:
1052 print:mu=peek(214)-1:gosub2000
1053 forx=1tok:printtab(13)x;"[157] [196]rive"dv(x):next
1054 printtab(13)x;"[157] [197]xit "
1060 gosub1100
1070 poke198,0:wait198,1:getz$
1071 ifz$=""then1200
1072 ifz$="[145]"then1210
1073 ifz$=chr$(13)thenz=mm+1:goto1221
1074 z=val(z$):ifz>0andz<k+2then1220
1075 goto1070
1100 poke214,mu+om:print
1101 ifom=kthenprinttab(13)"[146]"k+1"[157] [197]xit ":goto1110
1102 printtab(13)"[146]"om+1"[157] [196]rive"dv(om+1)"[157] "
1110 poke214,mu+mm:print
1111 ifmm=kthenprinttab(13)""k+1"[157] [197]xit ":return
1112 printtab(13)""mm+1"[157] [196]rive"dv(mm+1)"[157] "
1120 return
1200 om=mm:mm=mm+1:ifmm+1>k+1thenmm=0
1201 goto1060
1210 om=mm:mm=mm-1:ifmm<0thenmm=k
1211 goto1060
1220 om=mm:mm=z-1:gosub1100
1221 ifmm=kthen40000
1222 dv=d:d=dv(z):return
2000 mm=0:forx=1tok:ifd=dv(k)thenmm=x-1
2001 next:om=mm:return
9999 end
10000 d=peek(186):n$="b.dir to bas":open1,d,15,"i0":close1
10001 open1,d,15,"s0:"+n$:close1:saven$,d:end
10008 poke186,8:goto10000
40000 fori=0to21:poke828+i,8+i:next
40010 ifdv<8ordv>29ordv=8then40030
40020 a=peek(828):b=peek(828+dv-8):poke828,b:poke828+dv-8,a
40030 a$="hello connect":forj=8to29:i=peek(828+j-8):ifi=14thennext
40040 close2:open2,i,2:close2:ifstthen40060
40050 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then40070
40060 next:print"[147]":poke53272,23:poke186,8:end
40070 q$=chr$(34):poke646,peek(53281):print"[147]":poke53272,23
40080 print"[147]p[207]2048,0:p[207]44,8:p[207]43,1:p[207]56,160:p[207]55,0:clr:l[207]"q$a$q$","i
40090 print"run:":poke631,13:poke632,13:poke198,2:end